package pku;

public class MyUtilTool {

	// 获取 整数 num 的第 i 位的值
	public static boolean getBit(int num, int i) {
		return ((num & (1 << i)) != 0);// true 表示第i位为1,否则为0
	}

	// 将 整数 num 的第 i 位的值 置为 1
	public static int setBit(int num, int i) {
		return (num | (1 << i));
	}
	
	
	public static boolean getShort(short num, int i) {
		short mark = 1;
		return ((num & (mark << i)) != 0);// true 表示第i位为1,否则为0
	}
	
	public static short setBit(short num, int i) {
		short mark = 1;
		return (short)(num | (mark << i));
	}
	
	public static void main(String[] args) {
		short a = 0;
		a = setBit(a, 1);
		a = setBit(a, 11);
		System.out.println(a);
	}
}
